package com.smart.community.common.utils;

import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.crypto.hash.SimpleHash;

public class ShiroUtils {
    public static final int HASH_ITERATIONS = 10;

    /**
     * MD5
     * SHA-1
     * salt
     *
     * @param keyword
     * @return
     */
    public static String encryption(String keyword, String salt) {
        return new SimpleHash(Md5Hash.ALGORITHM_NAME, keyword, salt, HASH_ITERATIONS).toString();
    }

    public static String encryption(String keyword) {
        return encryption(keyword, null);
    }

    public static void main(String[] args) {
        System.out.println(ShiroUtils.encryption("123456"));
    }

}
